//
//  BasePageViewController.m
//  SleepApp
//
//  Created by MAC on 2021/3/20.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "BasePageViewController.h"
#import "NSObject+WLSel.h"

@interface BasePageViewController ()

@property (nonatomic,strong) BasePageView *wlclass_base_view;
@property (nonatomic,strong) WLNavigationScrollView *wlclass_navigation_view;
@end

@implementation BasePageViewController
-(void)viewDidLoad{
    [super viewDidLoad];
}
/** 重写父控制器方法*/
-(void)initView{
    [self.view addSubview:self.wlclass_base_view];
    [self.wlclass_base_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(kNavBarAndStatusBarHeight, 0, 0, 0));
    }];
}
/** 子控制可以开始加载数据了 */
-(void)initData{
    [self setNavigationScrollModelList:[self getNavigationScrollModelList]];
}
#pragma mark --- BasePageViewController 添加内容
/** 设置导航栏数据  动态导航栏数据用这个初始化 */
-(void)setNavigationScrollModelList:(NSArray<WLNavigationScrollModel *> *)modelList{
    if (modelList && modelList.count){
        [self.wlclass_navigation_view.wlclass_view_model initNavigationModelList:modelList];
    }
}
/** 静态导航烂数据重写此方法返回值即可 */
-(NSArray<WLNavigationScrollModel *> *)getNavigationScrollModelList{
    return [NSMutableArray array];
}
#pragma mark --- Navigation
-(UIView *)set_titleView{
    return self.wlclass_navigation_view;
}

#pragma mark --- 懒加载
-(BasePageView *)wlclass_base_view{
    if (!_wlclass_base_view){
        _wlclass_base_view = [[BasePageView alloc]init];
        _wlclass_base_view.nav_view_model = self.wlclass_navigation_view.wlclass_view_model;
    }
    return _wlclass_base_view;
}
-(WLNavigationScrollView *)wlclass_navigation_view{
    if (!_wlclass_navigation_view){
        _wlclass_navigation_view = [[WLNavigationScrollView alloc]init];
        _wlclass_navigation_view.wlclass_view_model.cellHeight = kNavBarHeight - 2;
        _wlclass_navigation_view.wlclass_view_model.horizontalSection = 10;
        _wlclass_navigation_view.wlclass_view_model.insetForSection = UIEdgeInsetsMake(0, 10, 0, 10);
    }
    return _wlclass_navigation_view;
}
@end


